package d1130.r2143num17;

import com.sun.org.apache.xpath.internal.objects.XString;

public class Demo01 {
    //隐士创建
    public static void main(String[] args) {
        String name1="李四 ";
        String name2="李四";
        String name3 =new String("李四");
        String name4 =new String("李四");
        System.out.println(name1==name3);//F
        System.out.println(name1==name4.intern());//T
        System.out.println(name2==name4);//F
        System.out.println(name2.intern()==name4.intern());//T

        /*
        System.out.println(name.equals(name2));//true
        System.out.println(name==name2);//true*/
        //显示创建  new
       // String name3 =new String("李四");
        //String name4 =new String("李四");
        System.out.println(name3.equals(name4));
        System.out.println(name3==name4);
        System.out.println(name3.intern());
        System.out.println(name4.intern());
        System.out.println(name3.intern().equals(name4.intern()));
        System.out.println(name3.intern()==name4.intern());
    }
}
